package com.example.demo.controller;

import com.example.demo.mapper.TestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class Test {

    @Autowired
    TestMapper testMapper;

    @Value("${server.port}")
    public String port;

    @GetMapping("/list")
    public List<Map<String,Object>> test(){
        List<Map<String, Object>> test = testMapper.test();
        Map<String,Object> map = new HashMap<>();
        map.put("port",port);
        test.add(map);
        return test;
    }
}
